package com.ggy.ggyaiagent.controller;


import com.ggy.ggyaiagent.app.LoveApp;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.model.ChatResponse;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

import java.util.UUID;

@RestController
@RequestMapping("/health")
public class HealthController {
    @Resource
    private LoveApp loveApp;
    @GetMapping
    public String healthCheck() {
        return "ok";
    }

    @GetMapping(value = "/streamChat", produces = "text/event-stream")
    public Flux<String> streamChat() {
        String chatId = UUID.randomUUID().toString();
        String data = "我是男性，单身，程序员，23岁，170cm，想要找一个女朋友，请你帮我推荐几个人！！！！，\" +\n" +
                "                \"并简略的告诉我，和谁在一起婚后和谐，性和谐，并给我规划一下如何俘获女生芳心";
        return loveApp.doChatByStream(data, chatId);
    }
}

